package toDo.app;

import interfaces.ILoginActivity;
import toDo.app.controllers.LoginActivityClickController;
import android.os.Bundle;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

/**
 * most of the m6 work needs to be done on this
 * 
 * 
 */
public class LoginActivity extends ILoginActivity {
	private Button loginButton, backButton;
	private EditText usernameField;
	private EditText passwordField;
	private TextView statusLabel;
	private LoginActivityClickController cController;
	
	/**
	 * Called when the activity is first created.
	 * 
	 * @param savedInstanceStace
	 *            the last instance for this app
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.login);

		loginButton = (Button) findViewById(R.id.loginLoginButton);
		usernameField = (EditText) findViewById(R.id.loginUsernameField);
		passwordField = (EditText) findViewById(R.id.loginPasswordField);
		statusLabel = (TextView) findViewById(R.id.loginStatusLabel);
		backButton = (Button) findViewById(R.id.loginBackButton);
		
		cController = new LoginActivityClickController(this);
		
		backButton.setOnClickListener(cController);
		loginButton.setOnClickListener(cController);
		
		statusLabel.setText(R.string.blank);
	}

	@Override
	public String getUsernameText() {
		return usernameField.getText().toString();
	}

	@Override
	public String getPasswordText() {
		return passwordField.getText().toString();
	}

	@Override
	public void setUsernameText(String text) {
		usernameField.setText(text);
	}

	@Override
	public void setPasswordText(String text) {
		passwordField.setText(text);
	}
}